import MainLayout from '@/layouts/MainLayout.vue'//主页面布局
const introduce = () => import('@/views/landing/index.vue')//介绍页
const Login = () => import('@/views/login/index.vue')//登录页
const register = () => import('@/views/login/Register.vue')//注册页
const forgetPassword = () => import('@/views/login/ForgotPassword.vue')//重置密码页 
const HomeView = () => import('@/views/MainPage/Home.vue')//登录后主界面
const VoiceLibrary = () => import('@/views/MainPage/VoiceLibrary.vue')//语音库
const TextToSpeech = () => import('@/views/MainPage/TextToSpeech.vue')//文本转语音
const StandardVoice = () => import('@/views/MainPage/StandardVoice.vue')//标准音色
const PPTcreation = () => import('@/views/MainPage/PPTCreation.vue')//PPT制作
const userCenter = () => import('@/views/MainPage/UserCenter.vue')//用户个人中心页
const LearnMore = () => import('@/views/MainPage/LearnMore.vue')//学习更多页
//对外暴露配置路由(常量路由)
export const constantRoutes = [
  // 新增官网介绍页（作为默认路由）
  {
    path: '/',
    name: 'Landing',
    component: introduce,
    meta: {
      showAuthButtons: true // 控制显示右上角登录/注册按钮
    }
  },
  {
    //登录页
    path: '/login',
    component: Login,
    name: 'Login'
  },
  //注册页
  {
    path: '/register',
    name: 'Register',
    component: register
  },
  //重置密码页
  {
    path: '/forgot-password',
    name: 'ForgotPassword',
    component: forgetPassword,
    meta: {
      requiresAuth: false, // 明确标识不需要登录即可访问
      isAuthPage: true // 标记为认证相关页面（用于统一处理样式等）
    }
  },
  {
    //登录后主界面
    path: '/main',
    component: MainLayout, // 使用布局组件
    children: [
      {
        path: '',
        name: 'Home',
        component: HomeView,
        meta: {
          requiresAuth: true // 需要登录才能访问
        }
      },
      {
        path: 'voice-library',
        name: 'VoiceLibrary',
        component: VoiceLibrary,
        meta: {
          requiresAuth: true
        }
      },
      {
        path: 'text-to-speech',
        name: 'TextToSpeech',
        component: TextToSpeech,
        meta: {
          requiresAuth: true
        }
      },
      {
        path: 'standard-voice',
        name: 'StandardVoice',
        component: StandardVoice,
        meta: {
          requiresAuth: true
        }
      },
      {
        path: 'ppt-creation',
        name: 'PPTCreation',
        component: PPTcreation,
        meta: {
          requiresAuth: true
        }
      },
      {
        path: 'learn-more',
        name: 'learn-more',
        component: LearnMore, 
      }
    ]
  },
  // 用户个人中心页
  {
    path: '/main/user-center',
    name: 'UserCenter',
    component: userCenter
  },
  {
    //404
    path: '/404',
    name: '404',
    component: () => import('@/views/404/index.vue')
  },
  //其他路径的重定向
  {
    path: '/:pathMatch(.*)',
    redirect: '404',
    name: 'Any'
  }
]